﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace HRM.Web.master
{
    public partial class ManageMenu : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindRepeater();
            }
        }

        void BindRepeater()
        {
            BLL.Menu BLL_ObjMenu = new BLL.Menu();
            grdMenu.DataSource = BLL_ObjMenu.GetAllMenus();
            grdMenu.DataBind();
            MakeAccessible(grdMenu);

            //rptMenus.DataSource = BLL_ObjMenu.GetAllMenus();
            //rptMenus.DataBind();
        }
        
        private void MakeAccessible(GridView grid)
        {
            if (grid.Rows.Count > 0)
            {
                //This replaces <td> with <th> and adds the scope attribute
                grid.UseAccessibleHeader = true;

                //This will add the <thead> and <tbody> elements
                grid.HeaderRow.TableSection = TableRowSection.TableHeader;

                //This adds the <tfoot> element. Remove if you don't have a footer row
                //grid.FooterRow.TableSection = TableRowSection.TableFooter;
            }
        }
    }
}